/*
 * ToolbarButton.java
 *
 * Copyright 2007 Tiberiumlabs
 *
 * This file is part of Tiberiumlabs Shards.
 *
 * Tiberiumlabs Shards is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Tiberiumlabs Shards is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package org.tiberiumlabs.shards.components;

import java.awt.Insets;
import javax.swing.Action;
import javax.swing.JButton;

/**
 * Swing button, optimized for using on toolbars.
 * Not opaque, not painting borders, hides action text, zero margins.
 *
 * @author <a href="mailto:paranoid.tiberiumlabs@gmail.com">Paranoid</a>
 */
public class ToolbarButton extends JButton {

    private static final Insets INSETS = new Insets(0, 0, 0, 0);

    public ToolbarButton() {
        super();
        init();
    }

    public ToolbarButton(Action action) {
        super(action);
        init();
    }

    private void init() {
        setOpaque(false);
        setBorderPainted(false);
        setHideActionText(true);
        setMargin(INSETS);
    }
}
